API Documentation
StringView.h
1 // StringView.h
3 //
5 
6 namespace nkMemory
7 {
21  class StringView final
22  {
23  public :
24 
29  StringView () noexcept ;
36  StringView (const char* data) noexcept ;
45  StringView (const char* data, unsigned long long size) noexcept ;
51  StringView (const nkLog::StringView& logStr) noexcept ;
58  StringView (const String& other) noexcept ;
64  StringView (const StringView& other) noexcept ;
70  StringView (StringView&& other) noexcept ;
74  ~StringView () ;
75 
76  // Getters
80  const char* getData () const ;
84  unsigned long long getSize () const ;
88  bool empty () const ;
92  char front () const ;
96  char back () const ;
97 
98  // Utils
106 
107  // Operators
113  StringView& operator= (const char* data) ;
119  StringView& operator= (const String& other) ;
125  StringView& operator= (const StringView& other) ;
131  StringView& operator= (StringView&& other) ;
137  char operator[] (unsigned long long index) const ;
144  String operator+ (char c) const ;
151  String operator+ (const char* data) const ;
158  String operator+ (const StringView& other) const ;
165  bool operator== (const char* other) const ;
172  bool operator== (const StringView& other) const ;
179  bool operator!= (const char* other) const ;
186  bool operator!= (const StringView& other) const ;
187 
188  public :
189 
196  template<typename T = std::string>
197  StringView (const std::string& str) noexcept ;
206  template<typename T = std::string>
207  StringView (const std::string& str, unsigned long long index, unsigned long long size = 0ull) noexcept ;
214  template<typename T = std::string_view>
215  StringView (const std::string_view& str) noexcept ;
224  template<typename T = std::string_view>
225  StringView (const std::string_view& str, unsigned long long index, unsigned long long size = 0ull) noexcept ;
226 
227  public :
228 
232  operator std::string () const ;
236  operator std::string_view () const ;
240  operator nkLog::String () const ;
244  operator nkLog::StringView () const ;
245 
252  StringView& operator= (const std::string& data) ;
259  StringView& operator= (const std::string_view& data) ;
260  } ;
261 
269  inline bool operator== (const char* c, const nkMemory::StringView& str) ;
270 }
nkMemory::StringView::empty
bool empty() const
nkMemory::StringView::StringView
StringView() noexcept
nkMemory::StringView::split
BufferCast< StringView > split(StringView separator)
nkLog
Encompasses all API of component NilkinsLog.
Definition: StringView.h:7
nkMemory::StringView::front
char front() const
nkMemory::StringView::getSize
unsigned long long getSize() const
nkMemory::StringView::getData
const char * getData() const
nkMemory::String
Class holding information about a string, with ownership over the data.
Definition: String.h:22
nkMemory::StringView
Class holding information about a string, with no ownership over the data.
Definition: StringView.h:22
nkMemory::BufferCast
Holds a Buffer and make it easy to cast the binary data.
Definition: BufferCast.h:18
nkMemory::StringView::back
char back() const
nkMemory
Encompasses all API of component NilkinsMemory.
Definition: Allocator.h:7